package com.iweb.service;

import com.common.datasource.DataSourceUtil;
import com.iweb.dao.HotelDao;
import com.iweb.dao.HotelDaoImpl;
import com.iweb.pojo.Hotel;

import java.util.ArrayList;
import java.util.List;

public class HotelService {
    public List<Hotel> selectHotelList(String hotel_name) {

        List<Hotel> hotels=new ArrayList<>();

        Hotel hotel=null;
        //连接数据库
        DataSourceUtil dataSourceUtil = new DataSourceUtil();
        dataSourceUtil.init();
        //创建数据库操作对象
        HotelDao hotelDao=new HotelDaoImpl(dataSourceUtil.getConnection());
        try{
            hotels=hotelDao.selectList(hotel_name);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            dataSourceUtil.close();
        }



        return hotels;
    }

    public List<Hotel> selectByLocal(String hotel_local) {
        return null;
    }
}
